/**
 * 
 * checkNetwork : 检查是否有网络
 * checkNetworkStatus: 监听网络变化
 * updateVersion: 更新版本
 * encryptionPhone 手机号加密
 * 
 * 
 */
const install = Vue => {
	// 字段类型转换
	Vue.prototype.typeConversion = {
		member: {
			label: '会员',
			page: '/pages/personalCenter/memberCenter/memberCenter'
		},
		basic: {
			label: '课程',
			page: '/pages/tabbarPages/courseList/courseList'
		},
	}

	Vue.prototype.encryptionPhone = (phoneNumber) => {
		// 对手机号进行加密处理
		phoneNumber = String(phoneNumber);
		if (!phoneNumber) return;
		let encryptedNumber = phoneNumber.substring(0, 3) + '****' + phoneNumber.substring(7);
		return encryptedNumber;
	}

	Vue.prototype.checkNetwork = () => {
		return new Promise((req, rej) => {
			uni.getNetworkType({
				success: async function(res) {
					console.log(res.networkType, '****网络*****')
					let flag = res.networkType != 'none';
					/**
					 * 
					 * true 有网络
					 * false 无网络
					 * 
					 */
					req(flag);
				}
			});
		})
	}

	Vue.prototype.checkNetworkStatus = () => {
		return new Promise((req, rej) => {
			uni.onNetworkStatusChange(function(res) {
				let flag = res.isConnected;
				if (flag) {
					uni.offNetworkStatusChange(() => {})
				}
				req(flag);
			});
		})
	}

	// 其他方式登录
	Vue.prototype.otherLoginClosePage = async function() {
		let selfInfo = await this.getSelfInfo() || {};
		let phone = selfInfo.phone || null;
		if (phone) {
			let pages = getCurrentPages(); // 获取当前页面栈的实例
			let currPage = pages[pages.length - 1]; //当前页面
			let prevPage = pages[pages.length - 2]; //上一个页面
			if (prevPage) {
				this.applicationRewritingNavigateBack({
					delta: 1, //返回层数，2则上上页
				})
			}
		} else {
			console.log('**绑定手机号**')
			uni.redirectTo({
				url: '/pages/loginWithVerCodeOrPass/bindPhone/bindPhone'
			});
		}
	}

	Vue.prototype._return = () => {
		let pages = getCurrentPages(); // 获取当前页面栈的实例
		let currPage = pages[pages.length - 1]; //当前页面
		let prevPage = pages[pages.length - 2]; //上一个页面
		if (prevPage) {
			this.applicationRewritingNavigateBack({
				delta: 1, //返回层数，2则上上页
			})
		} else {
			uni.switchTab({
				url: '/pages/tabbarPages/home/home'
			});
		}
	}

	// 判断密码是否满足条件
	Vue.prototype.hasChineseCharacters = (str) => {
		str = String(str);
		let obj = {
			flag: true,
			msg: ''
		};
		// 判断汉字
		let regex = /[\u4e00-\u9fa5]/; // 匹配任意一个汉字
		let haveChinese = regex.test(str); // true 密码中不可出现中文
		// 长度
		let minLength = 8; // 最小密码长度要求
		let maxLength = 16; // 最小密码长度要求
		let lengthMate = str.length < minLength || str.length > maxLength; // true 密码长度8-16位
		// 字符类型
		let typeRegex = /^(?=.*[a-zA-Z])(?=.*\d).+$/;
		let typeEnough = !typeRegex.test(str); // false 至少包含一个字母、一个数字
		// 重复字符
		let repeatRegex = /(.)\1{2,}/;
		let isRepeat = repeatRegex.test(str); // true 密码中不得连续出现3次或以上的相同字符

		if (haveChinese || lengthMate || typeEnough || isRepeat) {
			obj.flag = false;
			if (haveChinese) {
				obj.msg = '密码中不可出现中文';
			} else if (lengthMate) {
				obj.msg = '密码长度在8-16位之间';
			} else if (typeEnough) {
				obj.msg = '至少包含一个字母、一个数字';
			} else if (isRepeat) {
				obj.msg = '密码中不得连续出现3次或以上的相同字符';
			}
		} else {
			obj.flag = true;
			obj.msg = '';
		}
		return obj;
	}

	// 检测App版本号更新
	Vue.prototype.comparisonVersionHandler = function(v1, v2) {
		v1 = String(v1).split(".");
		v2 = String(v2).split(".");
		let len = Math.max(v1.length, v2.length);
		while (v1.length < len) {
			v1.push("0");
		}
		while (v2.length < len) {
			v2.push("0");
		}

		for (let i = 0; i < len; i++) {
			let num1 = parseInt(v1[i]),
				num2 = parseInt(v2[i]);

			if (num1 > num2) {
				return 1; // 版本是最新
			} else if (num1 < num2) {
				return -1; // 版本不是最新的
			}
		}
		return 0; // 版本相同
	}

	// 格式化时间显示
	Vue.prototype.formatterTime = function(val, split = '.') {
		return this.$moment(val).format(`YYYY${split}MM${split}DD HH:mm:ss`)
	}

	Vue.prototype.formatterDate = function(val, split = '.') {
		return this.$moment(val).format(`YYYY${split}MM${split}DD`)
	}

	Vue.prototype.formatterCustomTime = function(val, format = `YYYY.MM.DD`) {
		return this.$moment(val).format(format)
	}

	Vue.prototype.formatterCustomDate = function(val, format = 'YYYY.MM.DD') {
		return this.$moment(val).format(format)
	}

	// 格式化金额显示
	Vue.prototype.formatterAmountOfMoney = function(val, decimal = 2) {
		let price = Number(val);
		return (price / 100).toFixed(decimal)
	}

	// 复制内容
	Vue.prototype.copyInfo = function(val) {
		if (!val) {
			uni.showToast({
				icon: 'none',
				title: '暂无可复制内容',
				duration: 2000
			})
			return;
		}
		uni.setClipboardData({
			data: String(val), // 必须字符串
			success: function() {
				uni.showToast({
					icon: 'none',
					title: '复制成功',
					duration: 2000
				})
			}
		});
	}

	// 企业微信
	Vue.prototype.goCustomer = function(corpid, url) {
		// #ifndef APP-PLUS
		uni.showToast({
			title: '请在app打开',
			icon: "none"
		});
		// #endif
		if (!url || !corpid) return;
		let wechat = null
		plus.share.getServices(res => {
			wechat = res.find(i => i.id === 'weixin')
			if (wechat) {
				wechat.openCustomerServiceChat({
					corpid: corpid, //企业ID
					// url: 'https://work.weixin.qq.com/kfid/****', //客服地址
					url: url
				}, src => {
					console.log("success:")
				}, err => {
					console.log("error:")
				})
			} else {
				uni.showToast({
					title: '当前环境不支持微信操作',
					icon: "error"
				});
			}
		});
	}
	Vue.prototype.jumpPay = function(path) {
		plus.share.getServices(
			res => {
				let sweixin = null;
				for (let i in res) {
					if (res[i].id == 'weixin') {
						sweixin = res[i];
					}
				}
				//唤醒微信小程序
				if (sweixin) {
					sweixin.launchMiniProgram({
						id: 'gh_226f6c9ecef8', // 微信开放平台 --- 绑定的微信小程序的 --- 原始id
						type: 0, //小程序版本  0-正式版； 1-测试版； 2-体验版。
						path: path //小程序的页面,用传的参数在小程序接值判断跳转指定页面
					});
				} else {
					console.log("未安装微信逻辑")
				}
			}
		);
	}
	// 支付
	Vue.prototype.payMent = async function(initApi, info, callback) {
		let that = this;
		if (!initApi) return;
		let {
			code,
			data
		} = await that.$application_api[initApi](info);
		if (code != 0) return;
		if (!data || !data.pay_price) {
			this.applicationRewritingRedirectTo({
				url: `/pages/courseModule/paySuccess/paySuccess?no=${data.pay_no}`
			})
			return;
		}
		let page = `/pages/appPayPages/appPayPages?payId=${data.pay_no}`;
		// #ifdef APP-PLUS
		// APP端 调起微信小程序
		let commonStaticInfo = getApp().globalData.commonStaticInfo || {};
		let close_jump_info = commonStaticInfo.close_jump_info || {}
		let allInfo = uni.getSystemInfoSync();
		// 当前的版本号+型号
		let brand = allInfo.brand.toLowerCase(); // 品牌
		plus.runtime.getProperty(plus.runtime.appid, (verRes) => {
			let appVersionCode = (verRes.version + '' + verRes.versionCode).split('.').join('');
			if (!close_jump_info.close_jump_version || !close_jump_info.close_jump_brand || !
				close_jump_info.close_jump_brand.length) {
				that.jumpPay(page);
				return;
			}
			if (close_jump_info.close_jump_brand && close_jump_info.close_jump_brand.length && !
				close_jump_info.close_jump_brand.includes(brand)) {
				that.jumpPay(page);
				return;
			}
			if (close_jump_info.close_jump_version != appVersionCode) {
				that.jumpPay(page);
				return;
			}
			uni.showModal({
				title: '打开微信',
				content: '即将跳转至微信支付...',
				confirmText: '立即跳转',
				cancelText: '稍后跳转',
				success: function(res) {
					if (res.confirm) {
						that.jumpPay(page);
					} else if (res.cancel) {
						console.log('用户点击取消');
					}
				}
			});
		});
		// #endif

	}

	Vue.prototype.jumpMethods = function(info, showToast = true) {
		let that = this;
		let addIdInfo = {
			'wx02176cf225ec01fe': 'gh_226f6c9ecef8', // 刷题
			'wxd38c17a3d558133f': 'gh_83e717eab941', // 单词
		}
		let selfInfo = uni.getStorageSync('selfInfo') || {};
		let tabbarList = that.$store.state.m_upgrade.tabList;
		if (info.checkLogin && (!selfInfo || !selfInfo.id)) {
			this.applicationRewritingNavigateTo({
				url: '/pages/loginWithVerCodeOrPass/passWordLogin/passWordLogin'
			});
			return;
		} else if (info.pagePath) {
			let arr = tabbarList.filter(item => item.pagePath == info.pagePath) || [];
			if (arr && arr.length) {
				this.applicationRewritingSwitchTab({
					url: info.pagePath,
					success: function(e) {
						that.$store.commit('changeIsShow', false);
					}
				});
				that.$store.commit('changeTabActive', arr[0].key);
			} else {
				this.applicationRewritingNavigateTo({
					url: info.pagePath
				});
			}
		} else if (info.h5_url) {
			let url = encodeURIComponent(info.h5_url);
			this.applicationRewritingNavigateTo({
				url: `/pages/tabbarPages/external/external?links=${url}`
			});
		} else if (info.mini_program) {
			// #ifdef APP-PLUS
			plus.share.getServices((res) => {
				let sweixin = null;
				for (let i in res) {
					if (res[i].id == 'weixin') {
						sweixin = res[i];
					}
				}
				//唤醒微信小程序
				if (sweixin) {
					// APP端 调起微信小程序
					let commonStaticInfo = getApp().globalData.commonStaticInfo || {};
					let close_jump_info = commonStaticInfo.close_jump_info || {}
					let allInfo = uni.getSystemInfoSync();
					// 当前的版本号+型号
					let brand = allInfo.brand.toLowerCase(); // 品牌
					plus.runtime.getProperty(plus.runtime.appid, (verRes) => {
						let appVersionCode = (verRes.version + '' + verRes.versionCode).split(
							'.').join('');
						if (!close_jump_info.close_jump_version || !close_jump_info
							.close_jump_brand || !
							close_jump_info.close_jump_brand.length) {
							sweixin.launchMiniProgram({
								id: info.mini_program, //微信开放平台 --- 绑定的微信小程序的 --- 原始id
								type: 0, //小程序版本  0-正式版； 1-测试版； 2-体验版。
								path: info.path || ''
							});
							return;
						}
						if (close_jump_info.close_jump_brand && close_jump_info
							.close_jump_brand.length && !
							close_jump_info.close_jump_brand.includes(brand)) {
							sweixin.launchMiniProgram({
								id: info.mini_program, //微信开放平台 --- 绑定的微信小程序的 --- 原始id
								type: 0, //小程序版本  0-正式版； 1-测试版； 2-体验版。
								path: info.path || ''
							});
							return;
						}
						if (close_jump_info.close_jump_version != appVersionCode) {
							sweixin.launchMiniProgram({
								id: info.mini_program, //微信开放平台 --- 绑定的微信小程序的 --- 原始id
								type: 0, //小程序版本  0-正式版； 1-测试版； 2-体验版。
								path: info.path || ''
							});
							return;
						}
						uni.showModal({
							title: '打开微信',
							content: '即将跳转至微信...',
							confirmText: '立即跳转',
							cancelText: '稍后跳转',
							success: function(res) {
								if (res.confirm) {
									sweixin.launchMiniProgram({
										id: info
											.mini_program, //微信开放平台 --- 绑定的微信小程序的 --- 原始id
										type: 0, //小程序版本  0-正式版； 1-测试版； 2-体验版。
										path: info.path || ''
									});
								} else if (res.cancel) {
									console.log('用户点击取消');
								}
							}
						});
					});
				} else {
					uni.showToast({
						icon: 'none',
						title: '未安装微信，跳转小程序失败'
					});
					console.log('未安装微信逻辑');
				}
			});
			// #endif
			// #ifdef MP-WEIXIN
			if (!info.appId && !addIdInfo[info.mini_program]) return;
			uni.navigateToMiniProgram({
				appId: info.appId || addIdInfo[info.mini_program],
				path: info.url || '',
				extraData: info.data || {},
				envVersion: "release",
				success() {
					uni.showToast({
						icon: 'none',
						title: '正在跳转',
						mask: true
					})
				}
			})
			// #endif
		} else if (info.scoring) {
			that.$application_api.appLikeCredit();
			// #ifdef APP-PLUS
			if (plus.os.name == 'Android') {
				plus.runtime.openURL(info.scoring, function(e) {
					console.log('Open system default browser failed:' + e.message);
				});
			} else if (plus.os.name == 'iOS') {
				let appleId = 6468941951;
				plus.runtime.launchApplication({
					action: `itms-apps://itunes.apple.com/cn/app/id${appleId}?mt=8`
				}, function(e) {
					console.log('Open system default browser failed: ' + e.message);
				});
			}
			// #endif
		} else if (info.popup) {
			that[info.popup] = true;
			that.saveInfo ? that.saveInfo(info) : '';
		} else if (info.officialId) {
			// #ifdef APP-PLUS

			if (plus.os.name == 'Android') {
				plus.runtime.launchApplication(
					// https://mp.weixin.qq.com/s/IZFuogo9hSeEcjOp_V0ZkA
					{
						pname: 'com.tencent.mm'
					},
					function(e) {
						console.log('Open system default browser failed: ' + e.message);
					}
				);
			} else if (plus.os.name == 'iOS') {
				plus.runtime.launchApplication({
					action: 'weixin://'
				}, function(e) {
					console.log('Open system default browser failed: ' + e.message);
				});
			}
			// #endif
		} else if (showToast) {
			// uni.showToast({
			// 	icon: 'none',
			// 	title: '功能暂未开放~'
			// });
			let link = getApp().globalData.staticLink;
			let url = encodeURIComponent(link);
			this.applicationRewritingNavigateTo({
				url: `/pages/tabbarPages/external/external?links=${url}`
			});
		}
	}


	// 毫秒级时间戳转时分秒
	Vue.prototype.calculateDiffTime = function(val) {
		let day, hour, minute, second;
		let days, hours, minutes, seconds;

		days = 1000 * 60 * 60 * 24;
		hours = 1000 * 60 * 60;
		minutes = 1000 * 60;
		seconds = 1000;

		day = parseInt(val / days);
		hour = parseInt(val % days) > 0 ? parseInt(val % days / hours) : '';
		minute = parseInt(val % hours) > 0 ? parseInt(val % hours / minutes) : '';
		second = parseInt(val % minutes) > 0 ? parseInt(val % minutes / seconds) : '';

		day = day ? (day < 10 ? ('0' + day + ':') : day + ':') : '';
		hour = hour ? (hour < 10 ? ('0' + hour + ':') : (hour + ':')) : '00:';
		minute = minute ? (minute < 10 ? ('0' + minute + ':') : (minute + ':')) : '00:';
		second = second ? (second < 10 ? ('0' + second) : second) : '00';
		return day + hour + minute + second;
	}

	Vue.prototype.selectShare = function({
		shareInfo,
		index
	}) {
		console.log(shareInfo)
		// scene 值说明
		if (!shareInfo) return;
		// 值	说明
		// WXSceneSession	分享到聊天界面
		// WXSceneTimeline	分享到朋友圈
		// WXSceneFavorite	分享到微信收藏
		uni.share(Object.assign({}, shareInfo, {
			success: function(res) {
				console.log("success:" + JSON.stringify(res));
			},
			fail: function(err) {
				console.log("fail:" + JSON.stringify(err));
			}
		}))
	}

	// 督学老师信息
	Vue.prototype.getKfData = async function(initApi, info) {
		let that = this;
		if (!initApi) return;
		let {
			code,
			data
		} = await that.$application_api[initApi](info);
		if (code != 0) return;
		return data;
	}
	// 打开小程序显示二维码
	Vue.prototype.showFkQrCode = function(url) {
		let that = this;
		if (!url) return;
		// #ifdef APP-PLUS
		let page = `/pages/wechatQrCode/wechatQrCode?url=${url}`;
		// APP端 调起微信小程序
		let commonStaticInfo = getApp().globalData.commonStaticInfo || {};
		let close_jump_info = commonStaticInfo.close_jump_info || {}
		let allInfo = uni.getSystemInfoSync();
		// 当前的版本号+型号
		let brand = allInfo.brand.toLowerCase(); // 品牌
		plus.runtime.getProperty(plus.runtime.appid, (verRes) => {
			let appVersionCode = (verRes.version + '' + verRes.versionCode).split('.').join('');
			if (!close_jump_info.close_jump_version || !close_jump_info.close_jump_brand || !
				close_jump_info.close_jump_brand.length) {
				that.jumpPay(page);
				return;
			}
			if (close_jump_info.close_jump_brand && close_jump_info.close_jump_brand.length && !
				close_jump_info.close_jump_brand.includes(brand)) {
				that.jumpPay(page);
				return;
			}
			if (close_jump_info.close_jump_version != appVersionCode) {
				that.jumpPay(page);
				return;
			}
			uni.showModal({
				title: '打开微信',
				content: '即将跳转至微信小程序...',
				confirmText: '立即跳转',
				cancelText: '稍后跳转',
				success: function(res) {
					if (res.confirm) {
						that.jumpPay(page);
					} else if (res.cancel) {
						console.log('用户点击取消');
					}
				}
			});
		});
		// #endif
	}
	// 获取直播教室信息
	Vue.prototype.sysPublicLiveGetDetail = async function(public_live_id, live_id, student_project_id) {
		let that = this;
		// #ifdef APP-PLUS
		if (!public_live_id && !live_id) {
			uni.showToast({
				icon: 'none',
				title: '直播间参数错误'
			})
			return '';
		}
		let {
			code,
			msg,
			data
		} = await that.$application_api.newSysPublicLiveGetDetail({
			public_live_id: public_live_id,
			live_id: live_id,
			student_project_id: student_project_id
		})
		if (code != 0) return msg;
		that.addLiveRoom(data);
		// #endif
		// #ifdef H5
		uni.showToast({
			icon: 'none',
			title: '请使用拜课网专升本App观看直播'
		})
		// #endif
		return '';
	}
	// 进入直播间
	Vue.prototype.addLiveRoom = function(info, status = 'code') {
		let that = this;
		let selfInfo = uni.getStorageSync('selfInfo') || {};
		if (!selfInfo.id || !selfInfo.phone) {
			uni.showToast({
				icon: 'none',
				title: '请先登录'
			})
			this.applicationRewritingNavigateTo({
				url: '/pages/loginWithVerCodeOrPass/passWordLogin/passWordLogin'
			})
			return '';
		}
		if (status == 'code' && info.student_code) {
			that.bjyLive.startLiveTripleTemplateWithCode(info.student_code, selfInfo.name || '');
		} else if (info.roomId) {
			that.bjyLive.startLiveTripleTemplateWithSign(info.roomId, info.sign, {
				"name": info.userName,
				"number": info.userNumber || '',
				"type": info.userType || 0,
				"avatar": info.userAvatar || '',
				"groupId": info.userGroupId || 0,
			});
		} else {
			uni.showToast({
				icon: 'none',
				title: '直播间参数错误'
			})
		}

	}
	// 获取回放数据
	Vue.prototype.sysPublicLiveGetPlaybackDetail = async function(public_live_id, live_id, student_project_id) {
		let that = this;
		// #ifdef APP-PLUS
		if (!public_live_id && !live_id) {
			uni.showToast({
				icon: 'none',
				title: '回放参数错误'
			})
			return;
		}
		let {
			code,
			data
		} = await that.$application_api.newGetPlaybackToken({
			public_live_id: public_live_id,
			live_id: live_id,
			student_project_id: student_project_id
		})
		if (code != 0) return;
		that.watchPlayback(data, false)
		// #endif
		// #ifdef H5
		uni.showToast({
			icon: 'none',
			title: '请使用拜课网专升本App观看视频'
		})
		// #endif
	}
	// 观看回放
	Vue.prototype.watchPlayback = function(info, flag = true) {
		let that = this;
		// #ifdef H5
		uni.showToast({
			icon: 'none',
			title: '请使用拜课网专升本App观看视频'
		})
		// #endif
		// #ifdef APP-PLUS
		if (!info || !info.video_id) {
			uni.showToast({
				icon: 'none',
				title: '视频参数错误'
			})
			return;
		}
		let userInfo = uni.getStorageSync('selfInfo') || {};
		if (!flag) {
			if (info.room_id) {
				that.playback.startPlayback(info.room_id, info.token, {
					"userId": userInfo.id || "",
					"userName": userInfo.name || "",
				})
			} else {
				that.playback.startVideo(info.video_id, info.token, {
					"userId": userInfo.id || "",
					"userName": userInfo.name || "",
				});
			}
		}
		// that.playback.startVideo(info.video_id, info.token, {});
		return {
			video_id: info.video_id,
			room_id: info.room_id,
			token: info.token
		}
		// #endif
	}

	Vue.prototype.getInviteQrCode = async function() {
		let that = this;
		let {
			code,
			data
		} = await that.$application_api.getInviteQrCode();
		if (code != 0) return;
		return data
	}

	// 重新加载页面
	Vue.prototype.reload = function() {
		console.log('*************')
		const pages = getCurrentPages()
		const curPage = pages[pages.length - 1]
		curPage.onLoad(curPage.options) // 传入参数
		curPage.onShow()
		// curPage.onReady()
	}

	Vue.prototype.viewTeacherInfo = function(id) {
		let that = this;
		if (!id) return;
		this.applicationRewritingNavigateTo({
			url: '/pages/courseModule/teacherInfo/teacherInfo?id=' + id
		})
	}

	Vue.prototype.savePosterPath = async function(url) {
		let that = this;
		if (!url) return;
		let arr = [url];
		// #ifndef APP-PLUS
		uni.previewImage({
			current: url, // 当前显示图片的http链接
			urls: arr,
			longPressActions: {
				itemList: ['保存图片到相册'],
				success(data) {
					that.downImg(url)
				}
			}
		})
		// #endif
		// #ifdef APP-PLUS
		plus.nativeUI.previewImage(arr, {
			background: '#FFFFFF',
			current: 0,
			loop: false,
			onLongPress: function(e) {
				console.log('onLongPress: ' + JSON.stringify(e));
				var bts = [{
					title: "保存图片到相册"
				}];
				plus.nativeUI.actionSheet({
						buttons: bts
					},
					function(e) {
						console.log("选择了\"" + ((e.index > 0) ? bts[e.index - 1].title : "取消") +
							"\"");
						that.downImg(url)
					}
				);
			}
		});
		// #endif
	}
	// 下载图片
	Vue.prototype.downImg = async function(str,isDown = true) {
		if (!str) return;
		if(isDown){
			uni.downloadFile({
				url: str,
				success: function(res) {
					uni.saveImageToPhotosAlbum({
						filePath: res.tempFilePath,
						success: (f) => {
							// + f.path.split(
							// 	'file:///storage/emulated/0')[1]
							uni.showToast({
								icon: 'none',
								title: "图片保存成功"
							})
						},
						fail: (err) => {
							uni.showToast({
								icon: 'none',
								title: "图片保存失败"
							})
						}
					})
				}
			})
		}else{
			uni.saveImageToPhotosAlbum({
				filePath: str,
				success: (f) => {
					uni.showToast({
						icon: 'none',
						title: "图片保存成功"
					})
				},
				fail: (err) => {
					uni.showToast({
						icon: 'none',
						title: "图片保存失败"
					})
				}
			})
		}
		
	}
	// 获取随机字符
	Vue.prototype.getRandomString = function(length) {
		let result = '';
		const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
		const charactersLength = characters.length;
		for (let i = 0; i < length; i++) {
			result += characters.charAt(Math.floor(Math.random() * charactersLength));
		}
		return result;
	}

}



export default install;